#ifndef EMREFLECTOR_H
#define EMREFLECTOR_H

#include "Reflector.h"


class EMReflector : public Reflector
{
	public:
		EMReflector();
		virtual ~EMReflector();

		void startReflectionDraw(const Camera& camera, const vector<Light*>& lights);
		virtual void drawReflection(const Mesh* mesh);
		void endReflectionDraw();
		
		void init(const char* filename, ID3D11Device* g_device, ID3D11DeviceContext* g_context);
		

	private:
		// some should pass as CMVECTOR
		XMMATRIX buildViewMatrix(const XMFLOAT4& pos, const XMFLOAT4& x, const XMFLOAT4& y, const XMFLOAT4& z) const;

		ID3D11RenderTargetView*					rtv;
		ID3D11DepthStencilView*					dsv;

		XMFLOAT4X4								m_Proj;
		XMFLOAT4X4								mViewProj[6];

		XMFLOAT4X4								m_reflect;
		ID3DX11EffectMatrixVariable*			fx_m_WorldViewProj;
		ID3DX11EffectMatrixVariable*			fx_m_World;

		ID3DX11EffectShaderResourceVariable*	fx_tex_shadow_map;
		ID3DX11EffectVariable*					fx_lights;
		ID3DX11EffectScalarVariable*			fx_num_lights;
		ID3DX11EffectVectorVariable*			fx_pEye;
		ID3DX11EffectScalarVariable*			fx_bShadowed;
		ID3DX11EffectScalarVariable*			fx_bUsePCSS;

		std::vector<XMFLOAT4>					l_pos;
		std::vector<XMFLOAT4>					l_dir;

		D3D11_VIEWPORT							vp, app_vp;

};



#endif